<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/include/page.jsp"%>
<c:set value="${requestScope.response.data.pageInfoUtil }" var="pageInfoUtil"/>
<c:set value="${requestScope.response.data.list }" var="list"/>
<jsp:useBean id="pojo" class="com.icss.orders.vo.ReOrders"/>
<!DOCTYPE html>
<html lang="en">
	<head>
		<title>订单列表 - 西餐厅管理系统</title>
		<%@ include file="/common/include/head_title.jsp"%>
	</head>
	<body>
		<jsp:include page="/header.htm"></jsp:include>
		<section class="blog-section spad">
	        <div class="container">
	        	<div class="col-">
					<h2 class="sub-header">订单列表</h2>
					<form action="${rootPath }/head/orders/ordersList.htm" method="post" class="form-inline">
						<label for="keyword">关键字:</label>
						<input type="text" name="keyword" value="${requestScope.keyword }" class="form-control mr-sm-2">
						<label for="status">状态:</label>
							<select name="status" class="form-control mr-sm-2">
								<option value="">请选择</option>
								<c:forEach items="${pojo.enumsMap }" var="me" varStatus="stat">
									<c:if test="${fn:startsWith(me.key,'STATUS')}">
										<!-- 拆分,按照-拆分,取最后一个 -->
										<c:set value="${fn:split(me.key, '-')}" var="keys"/>
										<option value="${keys[1] }" ${requestScope.status == keys[1] ? 'selected' : '' }>${me.value }</option>
									</c:if>
								</c:forEach>
							</select>
						<input type="submit" class="btn btn-primary" value="搜索">
					</form>
				</div>
	        
				<div class="col-md-12">
					<div class="table-responsive">
						<table class="table table-striped table-hover">
							<thead>
								<tr>
									<th>序号</th>
									<th>收货人</th>
									<th>收货地址</th>
									<th>手机号</th>
									<th>总价格</th>
									<th>折扣</th>
									<th>应付金额</th>
									<th>状态</th>
									<th>下单时间</th>
									<th>操作</th>
								</tr>
							</thead>
							<tbody>
								<c:forEach items="${list }" var="listTemp" varStatus="stat">
									<tr>
										<td>${stat.count }</td>
										<td title="${listTemp.goods.name }">
											<a href="${rootPath }/head/orders/ordersUpdate.htm?id=${listTemp.id}" target="_blank">
												${fn:substring(listTemp.receName,0,subStrLen) }
											</a>
										</td>
										<td title="${listTemp.receAddress}">${fn:substring(listTemp.receAddress,0,subStrLen) }</td>
										<td>${listTemp.recePhone}</td>
										<td>${listTemp.totalPrice }</td>
										<td>${listTemp.discount }</td>
										<td>${listTemp.dealAmount }</td>
										<td>${listTemp.statusStr }</td>
										<td>${listTemp.createTime }</td>
										<td>
											<%-- <a onclick="return confirm('确认要删除吗?')" href="${rootPath }/head/UsersHeadServlet?method=cartDelete&id=${listTemp.id}" class="btn btn-danger">
												操作
											</a> --%>
										</td>
									</tr>
								</c:forEach>
							</tbody>
						</table>
					</div>
				</div>
				
				<div class="col-md-12">
					<form id="pageForm" action="${rootPath }/head/orders/ordersList.htm"
						method="post" class="form-inline">
						<!-- 设置一些参数 -->
						<input type="hidden" name="keyword" value="${requestScope.keyword }">
						<input type="hidden" name="st" value="${requestScope.st }">
						<input type="hidden" name="ed" value="${requestScope.ed }">

						<nav aria-label="Page navigation example">
							<ul class="pagination justify-content-end">
								<li class="page-item">
									<a href="#" class="page-link" onclick="return pageFormSubmit('pageForm', 'currentPage', '1', 'pageSize','${pageInfoUtil.pageSize}')">
										<span>首页</span>
									</a>
								</li>
								<li class="page-item">
									<a href="#" class="page-link" onclick="return pageFormSubmit('pageForm', 'currentPage', '${pageInfoUtil.prePage}', 'pageSize','${pageInfoUtil.pageSize}')">
										<span>上一页</span>
									</a>
								</li>
								<li class="page-item">
									<a href="#" class="page-link" onclick="return pageFormSubmit('pageForm', 'currentPage', '${pageInfoUtil.nextPage}', 'pageSize','${pageInfoUtil.pageSize}')">
										<span>下一页</span>
									</a>
								</li>
								<li class="page-item">
									<a href="#" class="page-link" onclick="return pageFormSubmit('pageForm', 'currentPage', '${pageInfoUtil.totalPage}', 'pageSize','${pageInfoUtil.pageSize}')">
										<span>尾页</span>
									</a>
								</li>
								<li class="page-item">共${pageInfoUtil.totalRecord }条,共${pageInfoUtil.totalPage}页</li>
								<li class="page-item">
									第<input type="text" id="currentPage" name="currentPage" class="form-control" value="${pageInfoUtil.currentPage }"  size="5" maxlength="5"/>页
								</li>
								<li class="page-item">
									<input type="text" id="pageSize" name="pageSize" class="form-control" value="${pageInfoUtil.pageSize }" size="5" maxlength="5"/>
								</li>
								<li class="page-item"><input type="submit" value="GO" class="form-control btn btn-primary"/></li>
							</ul>
						</nav>
					</form>
				</div>
			</div>
	    </section>
		<%@ include file="/common/include/head_footer.jsp"%>
	</body>
</html>